<script setup>
import { computed } from "vue";
import { RouterView, useRoute } from "vue-router";
import headerVue from "./components/frames/header.vue";
import footerVue from "./components/frames/footer.vue";

import { useAuthStore } from "@/stores";
const authStore = useAuthStore();

const route = useRoute();
const isAuthPage = computed(() => {
  return route.meta.isAuthPage;
});
</script>

<template>
  <headerVue v-if="!isAuthPage" />
  <main>
    <RouterView />
  </main>
  <footerVue v-if="!isAuthPage"></footerVue>
</template>

<style>
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700&display=swap");

body {
  font-family: "Noto Sans SC", sans-serif;
  background-color: #f9fafb;
  margin: 0;
  padding: 0;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* 导航栏样式 */
.navbar {
  background-color: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.navbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 4rem;
  padding: 0 1rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
}

.navbar-logo {
  height: 2rem;
  width: auto;
}

.navbar-title {
  margin-left: 0.5rem;
  font-size: 1.25rem;
  font-weight: bold;
  color: #059669;
}

.navbar-nav {
  display: none;
}

.nav-link {
  color: #6b7280;
  text-decoration: none;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}

.nav-link:hover {
  color: #374151;
  border-bottom-color: #d1d5db;
}

.nav-link.active {
  color: #111827;
  border-bottom-color: #059669;
}

.login-btn {
  background-color: #059669;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
}

.login-btn:hover {
  background-color: #047857;
}

/* 英雄区域样式 */
.hero {
  position: relative;
  background-color: white;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 10;
  padding-bottom: 2rem;
  background-color: white;
}

.hero-text {
  margin-top: 2.5rem;
  text-align: center;
}

.hero-title {
  font-size: 2.25rem;
  line-height: 1.2;
  font-weight: 800;
  color: #111827;
}

.hero-title span {
  display: block;
}

.hero-title .highlight {
  color: #059669;
}

.hero-description {
  margin-top: 0.75rem;
  font-size: 1rem;
  color: #6b7280;
  line-height: 1.5;
}

.hero-cta {
  margin-top: 1.25rem;
  text-align: center;
}

.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 2rem;
  background-color: #059669;
  color: white;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 0.375rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.cta-button:hover {
  background-color: #047857;
}

.hero-image {
  height: 14rem;
  width: 100%;
  object-fit: cover;
}

/* 热门攻略样式 */
.guides-section {
  background-color: #f9fafb;
  padding: 4rem 1rem;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title {
  font-size: 1.875rem;
  font-weight: 800;
  color: #111827;
  margin: 0;
}

.section-description {
  margin-top: 0.75rem;
  font-size: 1.25rem;
  color: #6b7280;
}

.guides-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4rem;
  padding-top: 3rem;
}

.guide-card {
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.guide-content {
  padding: 1.5rem;
}

.guide-author {
  display: flex;
  align-items: center;
}

.author-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
}

.author-info {
  margin-left: 0.75rem;
}

.author-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #111827;
}

.post-date {
  font-size: 0.875rem;
  color: #6b7280;
}

.guide-title {
  margin-top: 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
}

.guide-excerpt {
  margin-top: 0.75rem;
  font-size: 1rem;
  color: #6b7280;
  line-height: 1.5;
}

/* 最新讨论样式 */
.discussions-section {
  background-color: white;
  padding: 4rem 1rem;
}

.discussions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4rem;
  padding-top: 3rem;
}

.discussion-card {
  background-color: #f9fafb;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.discussion-content {
  padding: 1.5rem;
}

.discussion-stats {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  color: #6b7280;
}

.stats-separator {
  margin: 0 0.5rem;
}

/* 页脚样式 */
.footer {
  background-color: white;
  margin-top: 3rem;
  padding: 3rem 0;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin: -0.5rem -1.25rem;
}

.footer-link {
  padding: 0.5rem 1.25rem;
  color: #6b7280;
  text-decoration: none;
  font-size: 1rem;
}

.footer-link:hover {
  color: #111827;
}

.footer-copyright {
  text-align: center;
  color: #9ca3af;
  font-size: 1rem;
  margin-top: 2rem;
}

/* 响应式设计 */
@media (min-width: 640px) {
  .navbar-nav {
    display: flex;
    gap: 2rem;
  }

  .hero-text {
    text-align: left;
  }

  .hero-cta {
    text-align: left;
  }

  .hero-title {
    font-size: 3rem;
  }

  .hero-description {
    font-size: 1.125rem;
  }

  .hero-image {
    height: 18rem;
  }
}

@media (min-width: 1024px) {
  .hero-content {
    max-width: 50%;
  }

  .hero-image {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
  }

  .guides-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }

  .discussions-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}
</style>
